package com.intelligent.ispc.core.dto;

import com.intelligent.ispc.common.dto.AbstractValueObject;

/**
 * Created by dmrj on 2015/10/26.
 */
public class YieldDto extends AbstractValueObject {
    private Long id;
    private String groupKey;
    private long firstInspect = 0;
    private long firstPass = 0;
    private long firstFail = 0;
    private String fpy = "0.0";
    private long reTestInspect = 0;
    private long reTestPass = 0;
    private long reTestFail = 0;
    private String reTestYield = "0.0";
    private String totalYield = "0.0";
    private long totalPass = 0;
    private long totolInspect = 0;

    public void setYieldCount() {
        if (this.firstInspect != 0) {
            this.fpy = String.valueOf(Math.round((this.firstPass * 1.0 / this.firstInspect) * 100 * 100) / 100.00);
        }
        if (this.totolInspect != 0) {
            this.totalYield = String.valueOf(Math.round(((this.totalPass) * 1.0 / (this.totolInspect)) * 100 * 100) / 100.0);
        }


        if (this.reTestInspect != 0) {
            this.reTestYield = String.valueOf(Math.round((this.reTestPass * 1.0 / this.reTestInspect) * 100 * 100) / 100.0);
        }
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getGroupKey() {
        return groupKey;
    }

    public void setGroupKey(String groupKey) {
        this.groupKey = groupKey;
    }

    public long getFirstInspect() {
        return firstInspect;
    }

    public void setFirstInspect(long firstInspect) {
        this.firstInspect = firstInspect;
    }

    public long getFirstPass() {
        return firstPass;
    }

    public void setFirstPass(long firstPass) {
        this.firstPass = firstPass;
    }

    public long getFirstFail() {
        return firstFail;
    }

    public void setFirstFail(long firstFail) {
        this.firstFail = firstFail;
    }

    public String getFpy() {
        return fpy;
    }

    public void setFpy(String fpy) {
        this.fpy = fpy;
    }

    public long getReTestInspect() {
        return reTestInspect;
    }

    public void setReTestInspect(long reTestInspect) {
        this.reTestInspect = reTestInspect;
    }

    public long getReTestPass() {
        return reTestPass;
    }

    public void setReTestPass(long reTestPass) {
        this.reTestPass = reTestPass;
    }

    public long getReTestFail() {
        return reTestFail;
    }

    public void setReTestFail(long reTestFail) {
        this.reTestFail = reTestFail;
    }

    public String getReTestYield() {
        return reTestYield;
    }

    public void setReTestYield(String reTestYield) {
        this.reTestYield = reTestYield;
    }

    public String getTotalYield() {
        return totalYield;
    }

    public void setTotalYield(String totalYield) {
        this.totalYield = totalYield;
    }

    public long getTotalPass() {
        return totalPass;
    }

    public void setTotalPass(long totalPass) {
        this.totalPass = totalPass;
    }

    public long getTotolInspect() {
        return totolInspect;
    }

    public void setTotolInspect(long totolInspect) {
        this.totolInspect = totolInspect;
    }

}
